package logic

import (
	"context"
	"fmt"

	"MBTI/rpc/login/internal/svc"
	"MBTI/rpc/login/log"

	"github.com/zeromicro/go-zero/core/logx"
)

type IsExitLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewIsExitLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsExitLogic {
	return &IsExitLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *IsExitLogic) IsExit(in *log.IsExitReq) (*log.IsSuccessResp, error) {
	// todo: add your logic here and delete this line
	isExitresp, err := l.svcCtx.StudentModel.IsExit(in.StudentNo)
	fmt.Println("isExit:", isExitresp)
	if err != nil {
		return nil, err
	}
	return &log.IsSuccessResp{
		IsSuccess: isExitresp,
	}, nil
}
